<?php

declare(strict_types=1);

namespace App\Controller;

use App\Model\Contract;
use App\Model\ContractClass;
use App\Model\Member;
use App\Model\Special;
use Hyperf\Redis\Redis;
use Hyperf\ViewEngine\Contract\FactoryInterface;
use Hyperf\ViewEngine\Contract\ViewInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Util\Common;
use App\Model\Normal;
use function Hyperf\ViewEngine\view;
use Trait\ResponseMsg;

/**
 * 游客订单
 */
class VisitorOrderController extends AbstractController
{
    use ResponseMsg;

    protected Redis $redis;
    protected Normal $normal;

    public function __construct()
    {
        $this->normal = container()->get(Normal::class);
    }

    /**首页模版
     * @return FactoryInterface|ResponseInterface|ViewInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     * @throws \RedisException
     */
    public function visitorOrder(): FactoryInterface|ResponseInterface|ViewInterface
    {
        $normal = $this->normal->get_redis_array(Common::SET_WEB_NORMAL_WEN);//获取seo通用数据
        $class_list = ContractClass::homeClass();//获取全部分类
        return view('visitorOrder', [
            'normal' => $normal,
            'class_list' => $class_list,
        ]);
    }
}

